import React from "react";

export default function Table2({ list,delListByName }) {
  return (
    <div>
      <div className="tr">
        <div className="td">姓名</div>
        <div className="td">年龄</div>
        <div className="td">操作</div>
      </div>
      {list.map((item, index) => {
        return (
          <div className="tr" key={index}>
            <div className="td">{item.name}</div>
            <div className="td">{item.age}</div>
            <div className="td" onClick={() => {
                delListByName(item.name)
            }}>
              删除
            </div>
          </div>
        );
      })}
    </div>
  );
}
